From 5117ad86a2328d3aa23db2daba575ba2cc0abd4a Mon Sep 17 00:00:00 2001 From: Robert Lipe Date: Mon, 4 Dec 2017 11:31:07 -0600 Subject: [PATCH] Eliminate strftime in gopal.cc --- gopal.cc | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/gopal.cc b/gopal.cc index 95ee92bbd..b3cbef123 100644 --- a/gopal.cc +++ b/gopal.cc @@ -57,6 +57,9 @@ #include #include #include +#include +#include +#include #define MYNAME "gopal" static gbfile* fin, *fout; @@ -73,10 +76,10 @@ static double minspeed,maxspeed; static struct tm opt_tm; /* converted "date" parameter */ static arglist_t gopal_args[] = { - {"date", &optdate, "Complete date-free tracks with given date (YYYYMMDD).", NULL, ARGTYPE_INT, ARG_NOMINMAX }, - {"maxspeed", &optmaxspeed, "The maximum speed (km/h) traveling from waypoint to waypoint.", "200", ARGTYPE_INT, "1", "1000" }, - {"minspeed", &optminspeed, "The minimum speed (km/h) traveling from waypoint to waypoint. Set >0 to remove duplicate waypoints", "0", ARGTYPE_INT, "0", "999" }, - {"clean", &optclean, "Cleanup common errors in trackdata", "1", ARGTYPE_BOOL, ARG_NOMINMAX }, + {"date", &optdate, "Complete date-free tracks with given date (YYYYMMDD).", NULL, ARGTYPE_INT, ARG_NOMINMAX, nullptr }, + {"maxspeed", &optmaxspeed, "The maximum speed (km/h) traveling from waypoint to waypoint.", "200", ARGTYPE_INT, "1", "1000", nullptr }, + {"minspeed", &optminspeed, "The minimum speed (km/h) traveling from waypoint to waypoint. Set >0 to remove duplicate waypoints", "0", ARGTYPE_INT, "0", "999", nullptr }, + {"clean", &optclean, "Cleanup common errors in trackdata", "1", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -158,13 +161,13 @@ gopal_rd_init(const QString& fname) } static void -gopal_rd_deinit(void) +gopal_rd_deinit() { gbfclose(fin); } static void -gopal_read(void) +gopal_read() { char* buff; @@ -179,10 +182,15 @@ gopal_read(void) char tbuffer[64]; struct tm tm2; lat_old=0; - strftime(routename,sizeof(routename),"Tracklog %c",gmtime(&tx)); + route = route_head_alloc(); - route->rte_name = routename; + QDateTime qtx; + qtx.setTimeSpec(Qt::UTC); + qtx.setTime_t(tx); + route->rte_name = "Tracklog "; + route->rte_name += qtx.toString("ddd MMM M hh:mm:ss yyyy"); + route_add_head(route); line=0; @@ -335,13 +343,13 @@ gopal_read(void) } static void -gopal_route_hdr(const route_head* route) +gopal_route_hdr(const route_head*) { } static void -gopal_route_tlr(const route_head* rte) +gopal_route_tlr(const route_head*) { } @@ -381,19 +389,19 @@ gopal_wr_init(const QString& fname) } static void -gopal_wr_deinit(void) +gopal_wr_deinit() { gbfclose(fout); } static void -gopal_write(void) +gopal_write() { route_disp_all(gopal_route_hdr, gopal_route_tlr, gopal_write_waypt); } static void -gopal_exit(void) /* optional */ +gopal_exit() /* optional */ { } @@ -419,5 +427,7 @@ ff_vecs_t gopal_vecs = { gopal_args, CET_CHARSET_ASCII, 0 /* ascii is the expected character set */ /* not fixed, can be changed through command line parameter */ + , NULL_POS_OPS, + nullptr }; /**************************************************************************/ -- 2.30.2